
import { Tag, Typography, Button } from 'antd';
import RecordsBtn from '../component/recordsBtn'
const { Text } = Typography;

export const columns = [
    {
        title: '序号',
        dataIndex: 'serial',
        key: 'serial',
        align: 'center',
        width: 45,
        ellipsis: true,
        render: (text) => {
            return (
                <div>
                    <Text type="strong">{text}</Text>
                </div>

            )
        },
    },
    {
        title: '推送ID',
        dataIndex: 'pushId',
        key: 'pushId',
        align: 'center',
        width: 130,
        fixed: 'left',
        render: (text) => <Text type="danger">{text}</Text>,
    },
    {
        title: '任务创建人',
        dataIndex: 'creator',
        key: 'creator',
        align: 'center',
        width: 80,
        render: (text) => <Text>{text}</Text>,
    },
    {
        title: '任务创建时间',
        dataIndex: 'createTime',
        key: 'createTime',
        align: 'center',
        width: 100,
        ellipsis: true,
        render: (text) => <Text mark>{text}</Text>,
    },
    {
        title: '状态',
        dataIndex: 'status',
        key: 'status',
        align: 'center',
        width: 80,
        render: (text) => {
            // 根据 text 的值决定颜色和显示文本
            const isCompleted = text === '000';
            const color = isCompleted ? 'green' : 'red';
            const displayText = isCompleted ? '完成' : '正在运行';
            return (
                <div>
                    <Tag color={color}>{displayText}</Tag>
                </div>
            );
        },
    },
    {
        title: '推送记录',
        dataIndex: 'pushRecords',
        key: 'pushRecords',
        align: 'center',
        width: 100,
        render: (pushRecords) => (
            <RecordsBtn data={pushRecords}></RecordsBtn>
        ),
    },
];

export default columns;